package org.nepu.scr.indexrate.converter.riskrate.operationpersonnel;

import cn.hutool.json.JSONUtil;
import org.nepu.scr.indexrate.vo.riskrate.operationpersonnel.OperationPersonnelMenu;

import javax.persistence.AttributeConverter;
import javax.persistence.Convert;

@Convert
public class OperationPersonnelMenuConverter implements AttributeConverter<OperationPersonnelMenu, String> {
    @Override
    public String convertToDatabaseColumn(OperationPersonnelMenu operationPersonnelMenu) {
        return JSONUtil.toJsonStr(operationPersonnelMenu);
    }

    @Override
    public OperationPersonnelMenu convertToEntityAttribute(String s) {
        return JSONUtil.toBean(s, OperationPersonnelMenu.class);
    }
}
